/*
 * @Author: Wangjun
 * @Date: 2023-08-03 09:51:03SetExtend
 * @LastEditTime: 2023-08-25 16:31:36
 * @LastEditors: Wangjun
 * @Description:
 * @FilePath: \nodex\nodelogic\op_not.go
 * hnxr
 */
package nodelogic

import (
	"gitee.com/hnxr_1/nodex"
)

func init() {
	nodex.Reister(new(Not))
}

type Not struct {
	nodex.Node
	X1 nodex.Boolean `remark:"输入1"`
	Y  nodex.Boolean `remark:"输出Y,,out"`
}

func (m *Not) GetModelID() int {
	return nodex.ModLogic
}

/**
 * @description:
 * @return {*}
 */
func (m *Not) GetName() string {
	return "NOT"
}
func (m *Not) RegData() []byte {
	return nodex.MakeRegData(m, "非运算", m.GetName(), "")
}

func (m *Not) Calc() (err error) {
	if m.EnQ {
		if *m.X1.Bad {
			m.Bad = true
			return //不计算
		}
	}

	m.Bad = false
	m.Y.Value = !m.X1.Value
	//fmt.Printf("NOT:%p\n", m.X1.BoolValue)
	return
}
